<?php

/*****************************************************************
 * INIT
 */
	$DECKROOT = getcwd();

/*****************************************************************/


/* Decks */
function getDeckToScreen($dbHost,$dbUser,$dbPass,$dbName)
{	
	$XML = new DOMDocument();
	$Decklist = new pmtData($dbHost,$dbUser,$dbPass,$dbName);
	if($Decklist->getDeckList() != null)
	{
		$XML->loadXML( $Decklist->getDeckList("DOM"));
	}
	
	/* xsl */
	$deckXSL = './xsl/lp_decks.xsl';
	$XSL = new DOMDocument();
	$XSL->load( $deckXSL );
	
	# START XSLT
	$xslt = new XSLTProcessor();
	$xslt->importStylesheet( $XSL );
	
	#PRINT
	echo $xslt->transformToXML( $XML );
}


function getDeckToXML($dbHost,$dbUser,$dbPass,$dbName)
{
	$XML = new DOMDocument();
	$Decklist = new pmtData($dbHost,$dbUser,$dbPass,$dbName);
	if($Decklist->getDeckList() != null)
	{
		echo ("<textarea cols='150' rows='20'>". $Decklist->getDeckList() ." </textarea>");
	}
}

/* Stacks */
function getStacksToScreen($dbHost,$dbUser,$dbPass,$dbName,$deckID)
{
	$XML = new DOMDocument();
	$Stack = new pmtData($dbHost,$dbUser,$dbPass,$dbName,'3');
	
	if($Stack->getStacksByDeckID($deckID) != null)
	{
		$XML->loadXML($Stack->getStacksByDeckID($deckID));
	}
	
	/* xsl */
	$deckXSL = './xsl/lp_decks.xsl';
	$XSL = new DOMDocument();
	$XSL->load( $deckXSL );
	
	# START XSLT
	$xslt = new XSLTProcessor();
	$xslt->importStylesheet( $XSL );
	
	#PRINT
	echo $xslt->transformToXML( $XML );
}


function getStacksToXML($dbHost,$dbUser,$dbPass,$dbName,$deckID)
{
	$XML = new DOMDocument();
	$Stack = new pmtData($dbHost,$dbUser,$dbPass,$dbName,'3');
	if($Stack->getStacksByDeckID($deckID) != null)
	{
		echo ("<textarea cols='150' rows='20'>". $Stack->getStacksByDeckID($deckID) ." </textarea>");
	}
}


/* Cards */
function getCardsToScreen($dbHost,$dbUser,$dbPass,$dbName,$stackID)
{
	$XML = new DOMDocument();
	$Card= new pmtData($dbHost,$dbUser,$dbPass,$dbName,'3');
	
	if($Card->getCardByStackID($stackID) != null)
	{
		$XML->loadXML($Card->getCardByStackID($stackID));
	}
	
	/* xsl */
	$deckXSL = './xsl/lp_decks.xsl';
	$XSL = new DOMDocument();
	$XSL->load( $deckXSL );
	
	# START XSLT
	$xslt = new XSLTProcessor();
	$xslt->importStylesheet( $XSL );
	
	#PRINT
	echo $xslt->transformToXML( $XML );
}


function getCardsToXML($dbHost,$dbUser,$dbPass,$dbName,$stackID)
{
	$XML = new DOMDocument();
	$Card= new pmtData($dbHost,$dbUser,$dbPass,$dbName,'3');
	if($Card->getCardByStackID($stackID) != null)
	{
		echo ("<textarea cols='150' rows='20'>". $Card->getCardByStackID($stackID) ." </textarea>");
	}
}
?>